<template>
  <div id="app">
    <news-header></news-header>
    <div id="container">
        <index-left v-if="!isAdmin"></index-left>
        <admin-left v-else></admin-left>
        <router-view></router-view>
    </div>
  </div>
</template>

<script>
import "@/assets/css/main.css"
import NewsHeader from './components/NewsHeader.vue'
import IndexLeft from './components/IndexLeft.vue'
import AdminLeft from './components/AdminLeft.vue'

export default {
  name: 'App',
  data(){
    return {
      isAdmin:false
    }
  },
  components: {
    NewsHeader,
    IndexLeft,
    AdminLeft
  },
  created(){
    this.$bus.$on('adminLogin',(permission)=>{
      if(permission == 1){
        this.isAdmin = true
      }else{
        this.isAdmin = false
      }
    })
  },
  mounted(){
    this.$router.push({name:'index-main'},()=>{})
  },
  beforeDestroy(){
    this.$bus.$off('adminLogin')
  }
}
</script>

<style>
  #a_b01{
    margin: 8px 0 0 0 ;
  }
  #logo>img{
    height: 69px;
  }
</style>
